// 成交明细
<template>
  <n-card
    title="五档成交明细"
    class="ClinchDealTheDetail"
    :data-currentTime="currentTime"
  >
    <n-grid x-gap="10" :cols="2" v-setColour="info.f43 - info.f60 >= 0">
      <n-gi>
        <div>
          <div class="mt10 fscjser table w100 fz12">
            <div class="trow">
              <div class="cell">卖5</div>
              <div class="cell">
                {{ info.f31 }}
              </div>
              <div class="cell">
                {{ info.f32 }}
              </div>
            </div>
            <div class="trow">
              <div class="cell">卖4</div>
              <div class="cell">
                {{ info.f33 }}
              </div>
              <div class="cell">
                {{ info.f34 }}
              </div>
            </div>
            <div class="trow">
              <div class="cell">卖3</div>
              <div class="cell">
                {{ info.f35 }}
              </div>
              <div class="cell">
                {{ info.f36 }}
              </div>
            </div>
            <div class="trow">
              <div class="cell">卖2</div>
              <div class="cell">
                {{ info.f37 }}
              </div>
              <div class="cell">
                {{ info.f38 }}
              </div>
            </div>
            <div class="trow">
              <div class="cell">卖1</div>
              <div class="cell">
                {{ info.f39 }}
              </div>
              <div class="cell">
                {{ info.f40 }}
              </div>
            </div>
            <div class="trow pr">
              <div class="jindueer">
                <span
                  class="kjmserer"
                  :style="{
                    width: mpbl + '%',
                  }"
                ></span>
              </div>
              <div class="cell">
                <p class="dfter"></p>
              </div>
              <div class="cell"></div>
              <div class="cell"></div>
            </div>

            <!--{{mpbl}}-->
            <div class="trow">
              <div class="cell">买1</div>
              <div class="cell">
                {{ info.f43 }}
              </div>
              <div class="cell">
                {{ info.f20 }}
              </div>
            </div>
            <div class="trow">
              <div class="cell">买2</div>
              <div class="cell">
                {{ info.f17 }}
              </div>
              <div class="cell">
                {{ info.f18 }}
              </div>
            </div>
            <div class="trow">
              <div class="cell">买3</div>
              <div class="cell">
                {{ info.f15 }}
              </div>
              <div class="cell">
                {{ info.f16 }}
              </div>
            </div>
            <div class="trow">
              <div class="cell">买4</div>
              <div class="cell">
                {{ info.f13 }}
              </div>
              <div class="cell">
                {{ info.f14 }}
              </div>
            </div>
            <div class="trow">
              <div class="cell">买5</div>
              <div class="cell">
                {{ info.f11 }}
              </div>
              <div class="cell">
                {{ info.f12 }}
              </div>
            </div>
          </div>
        </div>
      </n-gi>
      <n-gi>
        <div class="mt10 fscjser table w100 fz12">
          <template v-for="(sd, idx) in detailsgetList" :key="idx">
          <div class="trow" v-if="idx>3">
            <div class="cell">
              {{ sd.time }}
            </div>
            <div class="cell">
              {{ sd.je }}
              <span :class="sd.type == 1 ? 'ls' : 'red'">
                <span v-if="sd.type == 1">&darr; </span>
                <span v-else>&uarr;</span>
              </span>
            </div>
            <div class="cell" :class="sd.type == 1 ? 'ls' : 'red'">
              {{ sd.number }}
            </div>
          </div>
          </template>
        </div>
      </n-gi>
    </n-grid>
  </n-card>
</template>
<script lang='ts' setup>
import { ref, computed } from "vue";
import { dxget, qurl } from "../../util/index";
import store from "../../store";
import stock from "../../store/stock";
const props = defineProps({
  code: {
    type: String,
  },
});
let detailsgetList = ref();
let mpbl = ref();
const detailsget = async () => {
  let res: any = await dxget("dc/detailsget", {
    code: props.code,
  });
  detailsgetList.value = res.data;
};
const info:any =  computed(() => {
  return stock.state.gpinfo
})
let jnse = info
let maijs = jnse.f32 + jnse.f34 + jnse.f36 + jnse.f38 + jnse.f40; //卖
let maijsxw = jnse.f12 + jnse.f14 + jnse.f16 + jnse.f18 + jnse.f20; // 买
mpbl.value = (maijsxw / (maijs + maijsxw)) * 100;
detailsget();

const currentTime = computed(() => {
  const newDate = new Date();
  const Hours = newDate.getHours();
  const myddy = newDate.getDay(); //获取存储当前日期
  /*每天的15点以后 和9点前 周六和周天 不刷新 */
  console.log(myddy);
  if (Hours > 15 || Hours < 8 || myddy == 6 || myddy == 0) {
    return;
  }
  detailsget();
  return store.state.currentTime;
});
</script>
<style scoped>
.fscjser {
  height: 200px;
}

.jindueer {
  height: 3px;
  background: green;
  width: 150px;
  border-radius: 20px;
  overflow: hidden;
  position: absolute;
  left: 0;
  top: 0;
}

.dfter {
  height: 5px;
}

.kjmserer {
  position: absolute;
  left: 0;
  height: 100%;
  top: 0;
  background: red;
}

.datagetlIST-class {
  height: 300px;
  overflow: auto;
  margin-top: 20px;
}

.datagetlIST-class .el-timeline-item {
  padding-bottom: 10px !important;
}

.dfdsttye {
  position: sticky;
  top: 0;
  z-index: 999;
}

.dsfdtyyrr {
  height: 41px;
  line-height: 36px;
  border: 1px solid #e0e0e0;
  margin-bottom: 10px;
  line-height: 1.6;
  padding: 0 10px;
  cursor: pointer;
}

.dsfdtyyrr.act {
  color: red;
  border-color: red;
}

.dsfdtyyrr.acb {
  color: green;
  border-color: green;
}

.ehnnseert {
  height: 340px;
}

.date-line {
  height: 400px;
}
.ClinchDealTheDetail{
  height: 260px;
}
</style>
